<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <style>
    body>div{
      width: 200px;
      border: 1px solid red;
      /*当元素的所有子元素全部浮动后
      则自动识别的高度为0，后面元素元素会顶下来
      导致显示异常，添加以下样式解决此问题*/
      overflow: hidden;
    }
    #d1{
      width: 50px;
      height: 50px;
      background-color: red;
      float: left;
    }
    #d2{
      width: 50px;
      height: 50px;
      background-color: green;
      float: left;
    }
    #d3{
      width: 50px;
      height: 50px;
      background-color: blue;
      float: left;
    }
    p{
      width: 500px;
      height: 100px;
      background-color: purple;
      margin-top: 0;
    }
    ul{
        list-style: none;/*去掉图标*/
        margin: 0;
        padding: 0;
    }
    li{
        float: left;
        margin-right: 20px;
    }
    a{
        text-decoration: none;

    }
  </style>
</head>
<body>
<ul>
    <li><a href="">首页</a></li>
    <li><a href="">免费课</a></li>
    <li><a href="">直播课</a></li>
    <li><a href="">线上班</a></li>
    <li><a href="">线下班</a></li>
</ul>
<br>
<div>
  <div id="d1"></div>
  <div id="d2"></div>
  <div id="d3"></div>
</div>
<p></p>
</body>
</html>